﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Besture.Model;
using Besture.Bll;
using System.Data;
using Besture.Common.Definition;

namespace Besture.UI
{
    public partial class Index : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                InitData();
            }
            GetBanner();
        }

        #region 初始化数据
        private void InitData()
        {
            DataSet ds= new ActiveNewsDac().GetTopDataSet();
            rpActivity.DataSource= ds.Tables[0];
            rpActivity.DataBind();

            rpNewsList.DataSource = ds.Tables[1];
            rpNewsList.DataBind();

            rpProductList.DataSource = ds.Tables[2];
            rpProductList.DataBind();

            rpServiceList.DataSource = ds.Tables[3];
            rpServiceList.DataBind();
        }
        #endregion

        #region 获取Banner
        /// <summary>
        /// 获取Banner
        /// </summary>
        public void GetBanner()
        {
            HomeBannerDac imageDac = new HomeBannerDac();
            DataTable dt=imageDac.GetDataTable(4);
            rpBanner.DataSource = dt;
            rpBanner.DataBind();
            rbBannerTitle.DataSource = dt;
            rbBannerTitle.DataBind();
        }
        #endregion
    }
}